<div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
    <p class="span4 pull-left" style="font-size:16px; line-height:30px;"><strong><?php echo $this->translate('充值记录'); ?></strong></p>
    <p class="span8 text-right">
        <a href="<?php echo $this->myviewalias()->dbshopHelpUrl('user_paycheck_log'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
    </p>
</div>
<table class="table table-hover">
    <thead style="background:#CCC;">
    <tr>
        <th width="10%"><?php echo $this->translate('时间'); ?></th>
        <th width="5%"><?php echo $this->translate('状态'); ?></th>
        <th width="10%"><?php echo $this->translate('被充值人'); ?></th>
        <th width="8%"><?php echo $this->translate('审核人'); ?></th>
        <th width="8%"><?php echo $this->translate('充值金额/货币'); ?></th>
        <th width="8%"><?php echo $this->translate('完成时间'); ?></th>
        <th width="20%"><?php echo $this->translate('备注'); ?></th>
        <th width="8%"><?php echo $this->translate('操作'); ?></th>
    </tr>
    </thead>
    <form method="GET" action="<?php echo $this->url('usermoney/default',array('action'=>'paycheck')); ?>">
    <tr class="goods_search" style="background:#F5F5F5;">
        <td>
            <p>&nbsp;<?php echo $this->translate('始'); ?><input type="text" name="paycheck_start_time" id="paycheck_start_time" value="<?php if ($this->searchArray and isset($this->searchArray['paycheck_start_time'])) echo $this->searchArray['paycheck_start_time']; ?>" onclick="WdatePicker({el:'paycheck_start_time'})"  class="span8"></p>
            <p>&nbsp;<?php echo $this->translate('终'); ?><input type="text" name="paycheck_end_time" id="paycheck_end_time" value="<?php if ($this->searchArray and isset($this->searchArray['paycheck_end_time'])) echo $this->searchArray['paycheck_end_time']; ?>" onclick="WdatePicker({el:'paycheck_end_time'})" class="span8"></p>
        </td>
        <td>
            <select id="pay_state" name="pay_state" class="span11">
                <option value=""><?php echo $this->translate('请选择'); ?></option>
                <option value="10" <?php if ($this->searchArray and isset($this->searchArray['pay_state']) and $this->searchArray['pay_state'] == 10) echo 'selected'; ?>><?php echo $this->translate('未充值'); ?></option>
                <option value="20" <?php if ($this->searchArray and isset($this->searchArray['pay_state']) and $this->searchArray['pay_state'] == 20) echo 'selected'; ?>><?php echo $this->translate('充值完成'); ?></option>
            </select>
        </td>
        <td>
            <input type="text" name="user_name" value="<?php if ($this->searchArray and isset($this->searchArray['user_name'])) echo $this->searchArray['user_name']; ?>" class="span11">
        </td>
        <td>
            <input type="text" name="admin_name" value="<?php if ($this->searchArray and isset($this->searchArray['admin_name'])) echo $this->searchArray['admin_name']; ?>" class="span11">
        </td>
        <td>
            <input type="text" name="money_change_num" value="<?php if ($this->searchArray and isset($this->searchArray['money_change_num'])) echo $this->searchArray['money_change_num']; ?>" class="span11">
        </td>
        <td>
            <p>&nbsp;<?php echo $this->translate('始'); ?><input type="text" name="paycheck_start_finish_time" id="paycheck_start_finish_time" value="<?php if ($this->searchArray and isset($this->searchArray['paycheck_start_finish_time'])) echo $this->searchArray['paycheck_start_finish_time']; ?>" onclick="WdatePicker({el:'paycheck_start_finish_time'})"  class="span8"></p>
            <p>&nbsp;<?php echo $this->translate('终'); ?><input type="text" name="paycheck_end_finish_time" id="paycheck_end_finish_time" value="<?php if ($this->searchArray and isset($this->searchArray['paycheck_end_finish_time'])) echo $this->searchArray['paycheck_end_finish_time']; ?>" onclick="WdatePicker({el:'paycheck_end_finish_time'})" class="span8"></p>
        </td>
        <td>
            <input type="text" name="paycheck_info" value="<?php if ($this->searchArray and isset($this->searchArray['paycheck_info'])) echo $this->searchArray['paycheck_info']; ?>" class="span10">
        </td>
        <td>
            <button class="btn btn-small btn-primary" type="submit"><i class="icon-search icon-white"></i> <?php echo $this->translate('搜索'); ?></button>
            <?php if ($this->searchArray and !empty($this->searchArray)) { ?>
                &nbsp;&nbsp;<a href="<?php echo $this->url('usermoney/default',array('action'=>'paycheck')); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回'); ?></a>
            <?php } ?>
        </td>
    </tr>
    </form>
    <?php
    $state_array = array(20=>'<font color="green">'.$this->translate('充值完成').'</font>', 10=>'<font color="red">'.$this->translate('未充值').'</font>');
    ?>
    <?php if($this->user_paycheck_log) foreach ($this->user_paycheck_log as $log_value) { ?>
        <tr>
            <td><?php echo date("Y-m-d H:i:s", $log_value['paycheck_time']); ?></td>
            <td>
                <?php echo $state_array[$log_value['pay_state']]; ?>
            </td>
            <td><?php echo $log_value['user_name'];?></td>
            <td><?php echo !empty($log_value['admin_name']) ? $log_value['admin_name'].' - [<strong>'.$this->translate('管理员').'</strong>]' : '<strong>'.$this->translate('客户自行处理').'</strong>'; ?></td>
            <td><?php echo $log_value['money_change_num'] . ' / ' . $log_value['currency_code']; ?></td>
            <td><?php if(!empty($log_value['paycheck_finish_time'])) echo date("Y-m-d H:i:s", $log_value['paycheck_finish_time']); ?></td>
            <td><?php echo $this->escapeHtml($log_value['paycheck_info']); ?></td>
            <td>
                <a href="javascript:;" onClick="return del_paycheck_js(<?php echo $log_value['paycheck_id']; ?>);"><?php echo $this->translate('删除'); ?></a>
            </td>
        </tr>
        <?php
    }
    ?>
    <tr>
        <td colspan="8" style="background: #FFF">
            <?php echo ( count($this->user_paycheck_log) > 0 ) ? $this->paginationControl($this->user_paycheck_log, 'Sliding', 'common/pager',array('page_url'=>$this->url('usermoney/default/money_log_page',array('action'=>'paycheck')))) : ""; ?>
        </td>
    </tr>
</table>
<script src="<?php echo $this->basePath('/public/js/DatePicker/WdatePicker.js'); ?>"></script>
<script>
    function del_paycheck_js(paycheck_id) {
        if(window.confirm('<?php echo $this->translate('您确实要删除该充值记录吗？'); ?>')) {
            $.post("<?php echo $this->url('usermoney/default',array('action'=>'paycheckDel')); ?>",{paycheck_id:paycheck_id},
                function(data){
                    if(data != 'false') {
                        window.location.reload();
                        return true;
                    } else {
                        alert('<?php echo $this->translate('充值记录删除失败！'); ?>');
                    }
                });
        }
        return false;
    }
</script>